# Contributor: Mehdi Chinoune <mehdi.chinoune@hotmail.com>

_realname=libqxp
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=0.0.2
pkgrel=4
pkgdesc="Library for import of QuarkXPress documents. (mingw-w64)"
arch=('any')
mingw_arch=('ucrt64' 'clang64' 'clangarm64')
url='https://wiki.documentfoundation.org/DLP/Libraries/libqxp'
msys2_references=(
  'archlinux: libqxp'
)
license=('spdx:MPL-2.0')
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
         "${MINGW_PACKAGE_PREFIX}-icu"
         "${MINGW_PACKAGE_PREFIX}-librevenge")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-autotools"
             "${MINGW_PACKAGE_PREFIX}-boost"
             "${MINGW_PACKAGE_PREFIX}-cppunit")
source=("https://dev-www.libreoffice.org/src/${_realname}/${_realname}-${pkgver}.tar.xz")
sha256sums=('e137b6b110120a52c98edd02ebdc4095ee08d0d5295a94316a981750095a945c')

prepare() {
  cd "${_realname}-${pkgver}"

  autoreconf -fiv
}

build() {
  mkdir -p "${srcdir}/build-${MSYSTEM}" && cd "${srcdir}/build-${MSYSTEM}"

  ../"${_realname}-${pkgver}"/configure \
    --prefix="${MINGW_PREFIX}" \
    --enable-tools

  make
}

check() {
  cd "${srcdir}/build-${MSYSTEM}"

  make check
}

package() {
  cd "${srcdir}/build-${MSYSTEM}"

  make install DESTDIR="${pkgdir}"

  install -Dm644 "${srcdir}/${_realname}-${pkgver}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}
